{template 'common/header'}

<ul class="nav nav-tabs">
    <li{if $_GPC['do'] == 'AbnormalList'} class="active"{/if}><a href="{php echo $this->createWebUrl('AbnormalList',array('rid'=>$_GPC['rid']));}">异常数据</a></li>
    <li{if $_GPC['do'] == 'AbnormalCustomerList'} class="active"{/if}><a href="{php echo $this->createWebUrl('AbnormalCustomerList',array('rid'=>$_GPC['rid']));}">异常用户</a></li>
</ul>
<div class="panel panel-default">
    <div class="panel-heading">筛选</div>
    <div class="panel-body">
        <form action="./index.php" method="get" class="form-horizontal" role="form">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="laoyou_csyx" />
            <input type="hidden" name="do" value="AbnormalList"/>
            <input type="hidden" name="rid" value="{$_GPC['rid']}" />

            <div class="form-group">
                <label class="col-md-4 col-lg-1 control-label">微信号</label>
                <div class="col-md-4">
                    <input class="form-control" name="openid" type="text" value="{$_GPC['openid']}" placeholder="微信号">
                </div>
                <label class="col-md-4 col-lg-1 control-label">微信ID</label>
                <div class="col-md-4">
                    <input class="form-control" name="nickname" type="text" value="{$_GPC['nickname']}" placeholder="微信ID">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-4 col-lg-1 control-label">异常时间</label>
                <div class="col-md-4">
                    {php echo tpl_form_field_daterange('edittime', array('starttime'=>date('Y-m-d H:i:s', $_GPC['edittime']['start']),'endtime'=>date('Y-m-d H:i:s',$_GPC['edittime']['end'])),true);}
                </div>
                <label class="col-md-4 col-lg-1 control-label">游戏得分</label>
                <div class="col-md-2">
                    <input class="form-control" name="min" id="" type="text" value="{$_GPC['min']}" placeholder="分数下限">
                </div>
                <div class="col-md-2">
                    <input class="form-control" name="max" id="" type="text" value="{$_GPC['max']}" placeholder="分数上限">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-4 col-lg-1 control-label">状态</label>
                <div class="col-md-4">
                    <label class="radio-inline">
                        <input type="radio" name="abnormal" value="both" {if $_GPC['abnormal']=='both'}checked{/if}>不限
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="abnormal"  value="0" {if $_GPC['abnormal']=='0'}checked{/if}>正常
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="abnormal" value="1" {if $_GPC['abnormal']=='1'}checked{/if}>异常
                    </label>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-2" style="text-align:right;">
                    <button class="btn btn-default"><i class="fa fa-search"></i>搜索</button>
                </div>
            </div>
        </form>
    </div>

</div>

<div class="panel panel-default">
    <div class="panel-heading">
        异常排名列表
    </div>
    <div class="panel-body table-responsive">
        <table class="table table-hover" style="position:relative">
            <thead class="navbar-inner">
                <tr>
                    <th class='with-checkbox' style="width:50px;">
                        <input type="checkbox" class="check_all" />
                    </th>
                    <th style='width:400px'>微信号</th>
                    <th>微信ID</th>
                    <th>异常产生时间</th>
                    <th>游戏得分</th>
                    <th>状态</th>
                </tr>
            </thead>
            <tbody>
                {loop $abnormalData $data}
                <tr>
                    <td>
                        <input type="checkbox" class="idHidden" value="{$data['id']}">
                    </td>
                    <td>{$data['openid']}</td>
                    <td>{$data['nickname']}</td>
                    <td>{php echo date("Y年n月j日 H:i:s",$data['edittime']);}</td>
                    <td>{$data['score']}</td>
                    <td>
                        <div class="btnArea">
                            {if $data['abnormal']==0}
                            <button class='btn btn-success'>正常</button>
                            {else}
                            <button class='btn btn-danger'>异常</button>
                            {/if}
                        </div>
                    </td>
                </tr>
                {/loop}
                <tr>
                    <td colspan="6">
                        <button class="btn btn-success" id="multiNormalBtn">批量标记正常</button>
                        <button class="btn btn-danger" id="multiAbnormalBtn">批量标记异常</button>
                    </td>
                </tr>
            </tbody>
        </table>
        {$pager}
    </div>
</div>
<script>
    $(function () {

        //批量标记异常
        $("#multiAbnormalBtn").click(function () {
            var ids = '';
            $('.idHidden').each(function () {
                if ($(this).get(0).checked) {
                    ids += $(this).val() + ",";
                }
            });
            ids = ids.substring(0, ids.length - 1);
            $.post("{php echo $this->createWebUrl('MultiAbnormal',array('rid'=>$_GPC['rid']));}", {
                ids: ids
            }, function (data) {
                if (data == 1) {
                    alert("修改成功");
                    location.href = location.href;
                }
            });
        });
        //批量标记异常
        $("#multiNormalBtn").click(function () {
            var ids = '';
            $('.idHidden').each(function () {
                if ($(this).get(0).checked) {
                    ids += $(this).val() + ",";
                }
            });
            ids = ids.substring(0, ids.length - 1);
            $.post("{php echo $this->createWebUrl('MultiNormal',array('rid'=>$_GPC['rid']));}", {
                ids: ids
            }, function (data) {
                if (data == 1) {
                    alert("修改成功");
                    location.href = location.href;
                }
            });
        });

        //全选
        $(".check_all").click(function () {
            var checked = $(this).get(0).checked;
            $(':checkbox').each(function () {
                this.checked = checked;
            });
        });
    });
</script>

{template 'common/footer'}